
def evaluate_evasion_rate(detector, original_data, generated_data):
    """
    计算生成的伪装流量的逃逸率
    """
    original_preds = detector(original_data)
    generated_preds = detector(generated_data)
    
    false_negatives = ((original_preds < 0.5) & (generated_preds >= 0.5)).sum().item()
    true_negatives = (original_preds < 0.5).sum().item()
    
    evasion_rate = false_negatives / (false_negatives + true_negatives)
    return evasion_rate
